package com.ricchieri.manage.bean;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import com.ricchieri.common.BusinessSettings;
import com.ricchieri.util.FacesUtil;

@ManagedBean(name = "editCharterExpenseMB")
@ViewScoped
public class EditCharterExpenseManageBean extends CommonCharterExpenseManageBean {

	private static final long serialVersionUID = -2708013969378031014L;

	public String save() {
		getCharterExpense().setCharterExpenseType(obtainCharterExpenseType(getSelectedCharterExpenseType()));
		getCharterExpense().setCharter(getCharter());
		getCharterExpenseService().updateCharterExpense(getCharterExpense());
		FacesUtil.addParametersFlash(BusinessSettings.KEY_CHARTER, getCharter());
		FacesUtil.addParametersFlash(BusinessSettings.KEY_CHARTER_EXPENSE, getCharterExpense());
		return BusinessSettings.SUCCESS;
	}

}
